Preprocessing Data In R